package com.view.resourcemanage.SupplierFrame;

import com.bean.Customer;
import com.bean.Supplier;
import com.lovo.netCRM.component.LovoButton;
import com.service.CustomerService;
import com.service.SupplierService;
import com.service.impl.CustomerServiceImpl;
import com.service.impl.SupplierServiceImpl;
import com.view.MainFrame;
import com.view.resourcemanage.CustomerFrame.CustomerShowDialog;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class SupplierShowDialog extends JDialog {

    private LovoButton addBtn;
    private LovoButton cancelBtn;
    private JLabel nameTxt,directorTxt,telTxt,emailTxt,addressTxt,rangeTxt;


    private MainFrame frame ;
    private int key;
    private SupplierService supplierService = new SupplierServiceImpl();

    public SupplierShowDialog(MainFrame frame,int key) {
        // TODO Auto-generated constructor stub
        super(frame,"供应商详情",true);
        this.frame = frame;
        this.key = key;
        this.setBounds(350, 250, 520, 400);
        this.setLayout(null);
        this.init();
        this.setVisible(true);

    }



    private void init() {
        // TODO Auto-generated method stub
        Supplier supplier = new Supplier();
        supplier = supplierService.getSupplierInfo(key);

        nameTxt = new JLabel();
        nameTxt.setBounds(20,20,150,60);
        nameTxt.setText("<html>供应商："+supplier.getName()+" </html>");
        this.add(nameTxt);

        directorTxt = new JLabel();
        directorTxt.setBounds(20,90,150,60);
        directorTxt.setText("<html>负责人："+supplier.getDirector()+" </html>");
        this.add(directorTxt);

        telTxt = new JLabel();
        telTxt.setBounds(20,160,150,60);
        telTxt.setText("<html>联系方式："+supplier.getDirectorTel()+" </html>");
        this.add(telTxt);



        addressTxt = new JLabel();
        addressTxt.setBounds(300,90,150,60);
        addressTxt.setText("<html>地址："+supplier.getAddress()+" </html>");
        this.add(addressTxt);

        rangeTxt = new JLabel();
        rangeTxt.setBounds(300,160,150,60);
        rangeTxt.setText("<html>经营范围："+supplier.getManageRange()+" </html>");
        this.add(rangeTxt);


        this.cancelBtn = new LovoButton("取消", 270, 320, this);

        cancelBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                SupplierShowDialog.this.dispose();;
            }
        });

    }


}
